package com.hsc.yalebao.tabMine;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.AboutBean;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.CustomDialog;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import okhttp3.Call;

public class AboutActivity extends BaseActivity
  implements View.OnClickListener
{
  private static Context context;
  private static File myCaptureFile;
  private String TAG = "AboutActivity";
  private ImageView iv_copy_qq;
  private ImageView iv_copy_url;
  private ImageView iv_copy_weixin;
  private ImageView iv_down;
  private ImageView iv_qrcode;
  private ImageView iv_title_right;
  private int memberid;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      default:
        return;
      case 2131099699:
        CustomApplication.app.finishActivity(AboutActivity.this);
        return;
      case 2131099715:
      }
      AboutActivity.this.showErWeimaPopupWindow();
    }
  };
  TextView tv_domain;
  TextView tv_qq;
  TextView tv_version;
  TextView tv_weixin;

  private void delayed(final ImageView paramImageView)
  {
    new Handler().postDelayed(new Runnable()
    {
      public void run()
      {
        if (paramImageView != null)
          paramImageView.setImageResource(2130838008);
      }
    }
    , 2000L);
  }

  private void getAbout()
  {
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    HashMap localHashMap = new HashMap();
    localHashMap.put("memberid", this.memberid);
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_ABOUT);
    showLoadingDialog();
    RequestNet.get(context, AppConstants.URL_GET_ABOUT, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        AboutActivity.this.dismissLoadingDialog();
        LogUtils.e(AboutActivity.this.TAG, "获取失败,获取关于:" + paramAnonymousException);
      }

      public void onResponse(String paramAnonymousString)
      {
        AboutActivity.this.dismissLoadingDialog();
        LogUtils.d(AboutActivity.this.TAG, "result:数据" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
          LogUtils.d(AboutActivity.this.TAG, "为空时result:" + paramAnonymousString);
        AboutBean localAboutBean;
        do
        {
          return;
          Gson localGson = new Gson();
          try
          {
            localAboutBean = (AboutBean)localGson.fromJson(paramAnonymousString, AboutBean.class);
            if (localAboutBean == null)
            {
              LogUtils.e(AboutActivity.this.TAG, "model == null，获取失败");
              return;
            }
          }
          catch (Exception localException)
          {
            while (true)
            {
              localException.printStackTrace();
              localAboutBean = null;
            }
            if (localAboutBean.getFlag() == 0)
            {
              LogUtils.e(AboutActivity.this.TAG, "model.getFlag() == 0");
              return;
            }
            if (localAboutBean.getFlag() == -2)
            {
              AboutActivity.this.showDownWireDialog();
              return;
            }
            if (localAboutBean.getFlag() == -3)
            {
              AboutActivity.this.ShowFengjinDialog();
              return;
            }
            if (localAboutBean.getFlag() == -4)
            {
              AboutActivity.activityStack.backToMain(MainActivity.class, AboutActivity.context);
              return;
            }
          }
        }
        while (localAboutBean.getFlag() != 1);
        AboutActivity.this.tv_qq.setText(localAboutBean.getQq());
        AboutActivity.this.tv_weixin.setText(localAboutBean.getWeinxin());
        AboutActivity.this.tv_domain.setText(localAboutBean.getUrl());
        String str1 = localAboutBean.getShareqrcode();
        if (!"".equals(str1))
          if (!str1.contains("http"))
            break label469;
        label469: for (String str2 = str1; ; str2 = AppConstants.BASE_URL_IMG + str1)
        {
          LogUtils.e(AboutActivity.this.TAG, "qrcode:" + str1);
          UiUtil.loadImage(str2, AboutActivity.context, AboutActivity.this.iv_qrcode);
          LogUtils.e(AboutActivity.this.TAG, "qrcodeRel:" + str2);
          AboutActivity.this.iv_qrcode.setOnLongClickListener(new View.OnLongClickListener()
          {
            public boolean onLongClick(View paramAnonymous2View)
            {
              AboutActivity.this.showErWeimaPopupWindow();
              return false;
            }
          });
          AboutActivity.this.iv_down.setVisibility(0);
          LogUtils.e(AboutActivity.this.TAG, "model.getQq():" + localAboutBean.getQq());
          LogUtils.e(AboutActivity.this.TAG, "model.getWeinxin():" + localAboutBean.getWeinxin());
          LogUtils.e(AboutActivity.this.TAG, "model.getUrl():" + localAboutBean.getUrl());
          return;
        }
      }
    });
  }

  public static void saveFile(Bitmap paramBitmap, String paramString1, String paramString2)
    throws IOException
  {
    String str = Environment.getExternalStorageDirectory().getAbsolutePath() + paramString2;
    File localFile = new File(str);
    if (!localFile.exists())
      localFile.mkdirs();
    myCaptureFile = new File(str, paramString1);
    if (!myCaptureFile.exists())
      myCaptureFile.createNewFile();
    BufferedOutputStream localBufferedOutputStream = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
    paramBitmap.compress(Bitmap.CompressFormat.JPEG, 80, localBufferedOutputStream);
    UiUtil.showToast(context, "保存二维码成功");
    localBufferedOutputStream.flush();
    localBufferedOutputStream.close();
  }

  public void onClick(View paramView)
  {
    switch (paramView.getId())
    {
    case 2131099708:
    case 2131099710:
    default:
      return;
    case 2131099707:
      this.iv_copy_url.setImageResource(2130838009);
      delayed(this.iv_copy_url);
      String str3 = this.tv_domain.getText().toString();
      if (TextUtils.isEmpty(str3))
      {
        UiUtil.showToast("复制失败");
        return;
      }
      UiUtil.showToast("复制成功");
      UiUtil.copy(str3, context);
      return;
    case 2131099709:
      this.iv_copy_qq.setImageResource(2130838009);
      delayed(this.iv_copy_qq);
      String str2 = this.tv_qq.getText().toString();
      if (TextUtils.isEmpty(str2))
      {
        UiUtil.showToast("复制失败");
        return;
      }
      UiUtil.showToast("复制成功");
      UiUtil.copy(str2, context);
      return;
    case 2131099711:
    }
    this.iv_copy_weixin.setImageResource(2130838009);
    delayed(this.iv_copy_weixin);
    String str1 = this.tv_weixin.getText().toString();
    if (TextUtils.isEmpty(str1))
    {
      UiUtil.showToast("复制失败");
      return;
    }
    UiUtil.showToast("复制成功");
    UiUtil.copy(str1, context);
  }

  @TargetApi(19)
  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903040);
    context = this;
    setTitle(8, 0, 2130837809, "关于", 0, 8, 8, 0, true);
    this.tv_domain = ((TextView)findViewById(2131099708));
    this.tv_qq = ((TextView)findViewById(2131099710));
    this.tv_version = ((TextView)findViewById(2131099706));
    this.tv_weixin = ((TextView)findViewById(2131099712));
    this.iv_copy_url = ((ImageView)findViewById(2131099707));
    this.iv_copy_qq = ((ImageView)findViewById(2131099709));
    this.iv_copy_weixin = ((ImageView)findViewById(2131099711));
    this.iv_copy_url.setOnClickListener(this);
    this.iv_copy_qq.setOnClickListener(this);
    this.iv_copy_weixin.setOnClickListener(this);
    try
    {
      this.tv_version.setText("V" + getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
      this.iv_down = ((ImageView)findViewById(2131099715));
      this.iv_down.setVisibility(8);
      this.iv_down.setOnClickListener(this.onClickListener);
      this.iv_qrcode = ((ImageView)findViewById(2131099714));
      getAbout();
      return;
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      while (true)
        localNameNotFoundException.printStackTrace();
    }
  }

  protected void onPause()
  {
    super.onPause();
    if (myCaptureFile != null)
      sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(myCaptureFile)));
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    ((TextView)findViewById(2131099701)).setText(paramString);
    ((TextView)findViewById(2131099700)).setVisibility(paramInt1);
    ImageView localImageView = (ImageView)findViewById(2131099699);
    localImageView.setVisibility(paramInt2);
    localImageView.setOnClickListener(this.onClickListener);
    localImageView.setImageResource(paramInt3);
    TextView localTextView = (TextView)findViewById(2131099702);
    localTextView.setVisibility(paramInt5);
    localTextView.setOnClickListener(this.onClickListener);
    this.iv_title_right = ((ImageView)findViewById(2131099704));
    this.iv_title_right.setVisibility(paramInt6);
    this.iv_title_right.setOnClickListener(this.onClickListener);
    this.iv_title_right.setImageResource(paramInt7);
  }

  public void showErWeimaPopupWindow()
  {
    View localView = LayoutInflater.from(this).inflate(2130903172, null);
    TextView localTextView1 = (TextView)localView.findViewById(2131100231);
    TextView localTextView2 = (TextView)localView.findViewById(2131100232);
    final CustomDialog localCustomDialog = new CustomDialog(this, 2131361804).create(localView, true, 1.0F, 0.2F, 1.0F);
    localCustomDialog.show();
    localTextView1.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        Bitmap localBitmap = ((BitmapDrawable)AboutActivity.this.iv_qrcode.getDrawable()).getBitmap();
        try
        {
          AboutActivity.saveFile(localBitmap, "qrcode7.jpg", "/pic");
          localCustomDialog.dismiss();
          return;
        }
        catch (IOException localIOException)
        {
          while (true)
            localIOException.printStackTrace();
        }
      }
    });
    localTextView2.setOnClickListener(new View.OnClickListener()
    {
      public void onClick(View paramAnonymousView)
      {
        localCustomDialog.dismiss();
      }
    });
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabMine.AboutActivity
 * JD-Core Version:    0.6.2
 */